﻿package com.eitb.programas.streamingUefa{
	import flash.display.*;
	import flash.text.*;
	import flash.geom.*;
	import com.eitb.properties.*;
	import com.eitb.programas.*;
	import com.eitb.literales.*;
	import com.eitb.bitmaps.*;
	import com.eitb.programas.streamingUefa.literales.*;
	import com.eitb.programas.streamingUefa.botones.*;
	
	public class Main extends Sprite {		
		private static var STAGE_SIZE:Point = new Point(600, 394);
	
//		private var formato:String=loaderInfo.parameters.formato;
//		private var hostname:String=loaderInfo.parameters.hostname;
//		private var filename:String=loaderInfo.parameters.filename;
//		private var idioma:String=loaderInfo.parameters.idioma;
//		private var _scCG:String=loaderInfo.parameters.nombre;
		
		private var formato:String=loaderInfo.parameters.formato = "dieciseisnovenos";
		private var hostname:String=loaderInfo.parameters.hostname = "cp70268.live.edgefcs.net/live";
		private var filename:String=loaderInfo.parameters.filename = "eitb-ETBSat@5219";
		private var idioma:String=loaderInfo.parameters.idioma = "es";
		private var _scCG:String=loaderInfo.parameters.nombre = "uefa";		
		
		private var vStreaming:IVistaStreamingUefa;
		private var literales:StreamingUefaLiterales;
		
		public function Main():void  {
			trace("initMain");
			this.initStreaming();
		}
		private function initStreaming():void {
			var formatoTexto:TextFormat=new TextFormat();
			var mStreaming:ModeloStreamingUefa = new ModeloStreamingUefa();
			var dStreaming:DialogoStreamingUefa = new DialogoStreamingUefa();
			var stageProps:StageProperties = new StageProperties(600, 394, StageAlign.TOP_LEFT, StageScaleMode.NO_SCALE);
			addChild(dStreaming);
			
			formatoTexto.color=0xFFFFFF;
			formatoTexto.font="Verdana";
			formatoTexto.bold=true;			

			dStreaming.initControladorStreaming(mStreaming);
			mStreaming.initVistaStreaming(dStreaming);
			
			switch (this.idioma) {
				case "es" :
					mStreaming.initIdioma(Literales.ES);
					literales = new StreamingUefaLiterales(Literales.ES);
					break;
				case "en" :
					mStreaming.initIdioma(Literales.EN);
					literales = new StreamingUefaLiterales(Literales.EN);
					break;
				case "fr" :
					mStreaming.initIdioma(Literales.FR);
					literales = new StreamingUefaLiterales(Literales.FR);
					break;
				case "eu" :
					mStreaming.initIdioma(Literales.EU);
					literales = new StreamingUefaLiterales(Literales.EU);
					break;
				default :
					mStreaming.initIdioma(Literales.EN);
					literales = new StreamingUefaLiterales(Literales.EN);
			}
			
			mStreaming.initTextFormat(this.formato);
			mStreaming.initHostname(this.hostname);
			mStreaming.initFilename(this.filename);
			mStreaming.initCanal(this._scCG);
			mStreaming.initNielsen(this._scCG);
			mStreaming.initAkamai();
			
			dStreaming.initStage(stageProps);
			dStreaming.initBackground(new Bitmap(new FondoUefa2009()), Main.STAGE_SIZE);
			dStreaming.initVideo(this.formato);
			dStreaming.initLogo(new Bitmap(new EitbCom()));
			dStreaming.initMaximizeButton();
			dStreaming.initVolumeSlider();
			dStreaming.initTimeDisplay(this.formato, formatoTexto);
			dStreaming.initBufferingDisplay(this.formato, formatoTexto, literales.getLiteral(StreamingUefaLiterales.CARGANDO));
			//dStreaming.initStatusDisplay(this.formato, formatoTexto, literales.getLiteral(StreamingUefaLiterales.CONECTANDO));
			dStreaming.fitScreen();
			
			dStreaming.addChildrens();
			
			this.vStreaming = dStreaming;
		}
	}
}